import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){
            int n = sc.nextInt();
            int[] nums = new int[n];
            for(int i = 0; i < n; i++){
                nums[i] = sc.nextInt();
            }
            Arrays.sort(nums);
            System.out.println(find(nums, 0, 0, 1));
        }
        
    }
    public static int find(int[] nums, int index, int sum, int mul){
        int count = 0;
        for(int i = index; i < nums.length; i++){
            sum += nums[i];
            mul *= nums[i];
            if(sum > mul){
                count = count + 1 + find(nums, i + 1, sum, mul);
            }else if(nums[i] == 1){
                count = count + find(nums, i + 1, sum, mul);
            }else{
                break;
            }
            sum -= nums[i];
            mul /= nums[i];
            while(i < nums.length - 1 && nums[i] == nums[i + 1]){
                i++;
            }

        }
        return count;
    }
}